package longcaisuyun.longcai.com.yiliubabalongcaisuyun;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import longcaisuyun.longcai.com.suyunbean.CardBean;



/**
 * Created by Administrator on 2016/4/27.
 */
public class CardAdapter extends BaseAdapter {
    Context context;
    List<CardBean> list;
    ViewHolder vh;

    public CardAdapter(Context context, List<CardBean> list) {
        this.context = context;
        this.list = list;
    }
    public int getCount() {
        return list.size();
    }
    @Override
    public Object getItem(int position) {
        return null;
    }
    @Override
    public long getItemId(int position) {
        return 0;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            vh = new ViewHolder();
            convertView = View.inflate(context, R.layout.item_card, null);
            MyApplication.ScaleScreenHelper.loadView((ViewGroup) convertView);
            vh.textView85 = (TextView) convertView.findViewById(R.id.textView85);
            vh.textView86 = (TextView) convertView.findViewById(R.id.textView86);
            convertView.setTag(vh);
        } else {
            vh = (ViewHolder) convertView.getTag();
        }
        vh.textView85.setText(list.get(position).getBanktype());
        vh.textView86.setText(subString(list.get(position).getBankcard()));
        return convertView;
    }
    class ViewHolder {
        public TextView textView85;
        public TextView textView86;
    }
    public String subString(String  str) {
        return   "尾号"+str.substring(str.length()-4,str.length());
    }
}
